package at.jku.novellbedsidedevice.datasource.sleepquality;

import at.jku.novellbedsidedevice.datasource.AbstractDataObject;

public class SleepQualityDataObject extends AbstractDataObject {
	
	private float sleepQualityInPercent;
	private long timestamp;
	
	public SleepQualityDataObject(long timestamp, float sleepQualityInPercent) {
		this.timestamp = timestamp;
		this.sleepQualityInPercent = sleepQualityInPercent;
	}
	
	//An enum to descripe the sleeping behaviour during a short time intervall  
		public enum SleepQuality {
			CALM, RESTIVE, HECTIC  
		}
	
	// returns the sleepquality in percent (0.0 to 1.0)
	public float getQualityInPercent() {
		return sleepQualityInPercent;
	}
	
	// returns the sleepquality with "labels" (enumeration SleepQuality)
	public SleepQuality getQuality() {
		if (sleepQualityInPercent > 0.95) return SleepQuality.CALM;
		if (sleepQualityInPercent > 0.60) return SleepQuality.RESTIVE;
		return SleepQuality.HECTIC;
	}
	
	// returns the according timestamp
	public long getTimestamp() {
		return timestamp;
	}
}
